<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateOrdersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('orders', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('shop_id')->comment('超市id');
			$table->integer('user_id')->comment('用户id');
			$table->string('order_num')->unique()->comment('订单号');
			$table->string('wx_transaction_id')->nullable()->comment('微信支付订单号');
			$table->integer('amount')->comment('数量');
			$table->float('total', 10, 0)->comment('总价格');
			$table->integer('state')->comment('0代表未付款，1代表已付款');
			$table->integer('is_active')->nullable()->default(0)->comment('0不删除1假删除');
			$table->dateTime('pay_time')->nullable()->comment('支付时间');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('orders');
	}

}
